<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:cc="http://java.sun.com/jsf/composite">

	<h:outputStylesheet name="default.css" library="css" />

	<!-- INTERFACE -->
	<cc:interface>
		<cc:attribute name="paginator" required="true" type="org.maverick.web.jsf.managedbean.Paginator" />
		<cc:attribute name="update" required="true" type="java.lang.String" />
	</cc:interface>
	
	<!-- IMPLEMENTATION -->
	<cc:implementation>
	
		<div align="center" class="paginator">
		
			<h:panelGrid id="idPaginator" columns="3" rendered="#{cc.attrs.paginator.renderedAll}">
				
				<h:selectOneMenu value="#{cc.attrs.paginator.registerNumberForPage}">
					<f:selectItem itemLabel="5" itemValue="5" />
					<f:selectItem itemLabel="10" itemValue="10" />
					<f:selectItem itemLabel="15" itemValue="15" />
					<f:selectItem itemLabel="20" itemValue="20" />
					<f:selectItem itemLabel="25" itemValue="25" />
					<f:selectItem itemLabel="50" itemValue="50" />
					<p:ajax listener="#{cc.attrs.paginator.updateNumberForPage}" update="#{cc.attrs.update}, idPaginator" />			
				</h:selectOneMenu>
			
				<h:panelGrid columns="5" cellspacing="3" style="padding-left: 250px; padding-right: 250px;" rendered="#{cc.attrs.paginator.renderedAll}">
			
					<p:commandLink actionListener="#{cc.attrs.paginator.previousFirstPage}" update="#{cc.attrs.update}, idPaginator" disabled="#{cc.attrs.paginator.currentPage == 1}">
						<p:graphicImage url="/resources/img/paginator_first_activated.png" />
					</p:commandLink>
	
					<p:commandLink actionListener="#{cc.attrs.paginator.previousPage}" update="#{cc.attrs.update}, idPaginator" disabled="#{cc.attrs.paginator.currentPage == 1}">
						<p:graphicImage url="/resources/img/paginator_previous_activated.png" />
					</p:commandLink>
	
					<p:column>
						<h:selectOneMenu value="#{cc.attrs.paginator.currentPage}">
							<f:selectItems value="#{cc.attrs.paginator.pages}"/>
							<p:ajax listener="#{cc.attrs.paginator.updatePage}" update="#{cc.attrs.update}, idPaginator" />
						</h:selectOneMenu>
						<h:outputText value=" / #{cc.attrs.paginator.lastPage}" />
					</p:column>
	
					<p:commandLink actionListener="#{cc.attrs.paginator.nextPage}" update="#{cc.attrs.update}, idPaginator" disabled="#{cc.attrs.paginator.currentPage == cc.attrs.paginator.lastPage}">
						<p:graphicImage url="/resources/img/paginator_next_activated.png" />
					</p:commandLink>
	
					<p:commandLink actionListener="#{cc.attrs.paginator.goLastPage}" update="#{cc.attrs.update}, idPaginator" disabled="#{cc.attrs.paginator.currentPage == cc.attrs.paginator.lastPage}">
						<p:graphicImage url="/resources/img/paginator_last_activated.png" />
					</p:commandLink>
					
				</h:panelGrid>
				
				<h:outputText value="Total de Registros: #{cc.attrs.paginator.registerNumber}" rendered="#{cc.attrs.paginator.renderedAll}"/>
				
			</h:panelGrid>
		</div>
	</cc:implementation>
</html>